home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / dimslib / create_dims_windows.c next >
Encoding:
C/C++ Source or Header  |  1990-01-23  |  4.6 KB  |  153 lines

  1. /*
  2. ### create a dimension window ###
  3. */
  4.  
  5. #include <suntool/sunview.h>
  6. #include <suntool/panel.h>
  7.  
  8. void create_dims_windows()
  9. {
  10.     void dims_quit_proc(),dims_go_proc(),dims_analyze_proc();
  11.     void dims_type_option_proc(),dims_algorithm_option_proc();
  12.     int i,ipanel_row=0,px,py;
  13.     extern Frame frame,dims_frame,tser_frame;
  14.     extern Panel dims_panel;
  15.     extern Pixfont *boldfont;
  16.     extern Panel_item dims_quit_item,dims_go_item,dims_analyze_item;
  17.     extern Panel_item dims_type_option_item,dims_algorithm_option_item;
  18.     extern Panel_item dims_scale_max_item,dims_scale_factor_item;
  19.     extern Panel_item dims_lsf_start_item,dims_lsf_end_item;
  20.     extern short dims_panel_show,tser_panel_show;
  21.     extern int panel_colormap_on;
  22.     extern int dims_type_option,dims_algorithm_option;
  23.     extern int dims_lsf_start,dims_lsf_end;
  24.     extern int dims_scale_max;
  25.     extern double dims_scale_factor;
  26.     extern char string[];
  27.     
  28.     /* Turn on the flag */    
  29.     if(dims_panel_show){
  30.         window_set(dims_frame,WIN_SHOW,TRUE,0);    
  31.         return;
  32.     }
  33.     else
  34.         dims_panel_show = 1;
  35.  
  36.     if(tser_panel_show){
  37.         px = (int) window_get(tser_frame,WIN_X);
  38.         py = (int) window_get(tser_frame,WIN_Y) + (int) window_get(tser_frame,WIN_HEIGHT) +100;
  39.     }
  40.     else {
  41.         px = (int) window_get(frame,WIN_X) + (int) window_get(frame,WIN_WIDTH)/2;
  42.         py = (int) window_get(frame,WIN_Y) + (int) window_get(frame,WIN_HEIGHT) /2 +100;
  43.     }
  44.     /* Create tser frame */
  45.     dims_frame = window_create(frame,FRAME,
  46.         FRAME_NO_CONFIRM,       TRUE,
  47.         FRAME_LABEL,    "dimensions",
  48.         FRAME_SHOW_LABEL,       TRUE,
  49.         WIN_SHOW,       TRUE,
  50.         WIN_X,  px,
  51.         WIN_Y,  py,
  52.         WIN_FONT, boldfont,
  53.         0);
  54.     if(dims_frame == NULL) {
  55.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  56.         dims_panel_show = 0;
  57.         return;
  58.     }
  59.     /* Create Panel */
  60.     dims_panel = window_create(dims_frame, PANEL,
  61.         WIN_X, 0,
  62.         WIN_Y, 0,
  63.         WIN_FONT, boldfont,
  64.         0);
  65.     if(dims_panel == NULL) {
  66.         system_mess_proc(1,"No more windows. Clean up some windows to make room.");
  67.         (void) destroy_dims_windows();
  68.         return;
  69.     }
  70.     /* Create panel items */
  71.     dims_quit_item= panel_create_item(dims_panel, PANEL_BUTTON,
  72.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  73.         PANEL_LABEL_X, ATTR_COL(0),
  74.         PANEL_LABEL_IMAGE, panel_button_image(dims_panel, "Quit", 5, boldfont),
  75.         PANEL_NOTIFY_PROC, dims_quit_proc,
  76.         0);
  77.     dims_go_item= panel_create_item(dims_panel, PANEL_BUTTON,
  78.         PANEL_LABEL_IMAGE, panel_button_image(dims_panel, "Go", 5, boldfont),
  79.         PANEL_NOTIFY_PROC, dims_go_proc,
  80.         0);
  81.     dims_analyze_item= panel_create_item(dims_panel, PANEL_BUTTON,
  82.         PANEL_LABEL_IMAGE, panel_button_image(dims_panel, "Analyze", 7, boldfont),
  83.         PANEL_NOTIFY_PROC, dims_analyze_proc,
  84.         0);
  85.     dims_type_option_item= panel_create_item(dims_panel, PANEL_CYCLE,
  86.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  87.         PANEL_LABEL_X, ATTR_COL(0),
  88.         PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  89.         PANEL_LABEL_STRING, "Type: ",
  90.         PANEL_CHOICE_STRINGS,
  91.             "Fractal dimension",
  92.             "Correlation exponent",
  93.             "Information dimension",
  94.             "Pointwise dimension",
  95.             "User dimension",
  96.             0,
  97.         PANEL_VALUE, dims_type_option,
  98.         PANEL_NOTIFY_PROC, dims_type_option_proc,
  99.         0);
  100.     dims_algorithm_option_item= panel_create_item(dims_panel, PANEL_CYCLE,
  101.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  102.         PANEL_LABEL_X, ATTR_COL(0),
  103.         PANEL_DISPLAY_LEVEL, PANEL_CURRENT,
  104.         PANEL_LABEL_STRING, "Algorithm: ",
  105.         PANEL_CHOICE_STRINGS,
  106.             "Box algorithm",
  107.             "User algorithm A",
  108.             "User algorithm B",
  109.             0,
  110.         PANEL_VALUE, dims_algorithm_option,
  111.         PANEL_NOTIFY_PROC, dims_algorithm_option_proc,
  112.         0);
  113.  
  114.     sprintf(string, "%d", dims_scale_max);
  115.     dims_scale_max_item = panel_create_item(dims_panel, PANEL_TEXT,
  116.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  117.         PANEL_LABEL_X, ATTR_COL(0),
  118.         PANEL_VALUE, string,
  119.         PANEL_VALUE_DISPLAY_LENGTH, 5,
  120.         PANEL_LABEL_STRING, "# Scaling:",
  121.         0);
  122.     sprintf(string, "%lg", dims_scale_factor);
  123.     dims_scale_factor_item = panel_create_item(dims_panel, PANEL_TEXT,
  124.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  125.         PANEL_LABEL_X, ATTR_COL(0),
  126.         PANEL_VALUE, string,
  127.         PANEL_VALUE_DISPLAY_LENGTH, 9,
  128.         PANEL_LABEL_STRING, "Scale Factor:",
  129.         0);
  130.  
  131.     sprintf(string, "%d", dims_lsf_start);
  132.     dims_lsf_start_item= panel_create_item(dims_panel, PANEL_TEXT,
  133.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  134.         PANEL_LABEL_X, ATTR_COL(0),
  135.         PANEL_VALUE, string,
  136.         PANEL_VALUE_DISPLAY_LENGTH, 5,
  137.         PANEL_LABEL_STRING, "LSF Start:",
  138.         0);
  139.     sprintf(string, "%d", dims_lsf_end);
  140.     dims_lsf_end_item = panel_create_item(dims_panel, PANEL_TEXT,
  141.         PANEL_LABEL_Y, ATTR_ROW(ipanel_row++),
  142.         PANEL_LABEL_X, ATTR_COL(0),
  143.         PANEL_VALUE, string,
  144.         PANEL_VALUE_DISPLAY_LENGTH, 5,
  145.         PANEL_LABEL_STRING, "LSF End:",
  146.         0);
  147.     window_fit(dims_panel);
  148.     window_fit(dims_frame);
  149.  
  150.     if(panel_colormap_on)
  151.         init_panel_colormap((Pixwin *) window_get(dims_panel,WIN_PIXWIN),"dims_panel_cms");
  152. }
  153.